﻿using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;

namespace GBricks
{
  public static class Invariant
  {
    [Pure]
    public static void Requires(bool conditional) {
      if(!conditional) {
        Throw.InvalidOperation();
      }//if
    }

    [Pure]
    public static void Requires(bool conditional, string message) {
      if(!conditional) {
        Throw.InvalidOperation(message);
      }//if
    }

    [SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "object", Justification = Justifications.AssumeInvariantHelper)]
    [Pure]
    public static void AssumeInvariant<T>(T @object) { }
  }
}
